Getting input from the user!

It is very important in a program to get input from the user.
We use Scanner class in Java to get input from the user.
From the obtained input, we process the output. Let's see how we do it.
Scanner sc=new Scanner(System.in);
Scanner Sc allows us to create a new scanner class and then we pass it on as reference in 'System.in' which stands for system input aka input from the system
int rollno=sc.nextInt();
String name=sc.next();
double fee=sc.nextDouble();
These are the scanner classes for accepting input for String, Int and Double.

Try running the program and see the output.

Are you able to enter your own values and get an output